#ifndef FORAMT_SPECIFY_HPP
#define FORAMT_SPECIFY_HPP

#include "../Platform.hpp"
#include <string>

namespace Model {

enum class DataType { FLOAT32, INT32, UINT32, INT16, UINT16, INT8, UINT8 };
enum class AttribType { TexCoords, Pos, Norm, BiTan, Tangents, VCols, Count };

static inline GLenum GetGLType(DataType type) {
  static GLenum table[] = {GL_FLOAT,          GL_INT,  GL_UNSIGNED_INT, GL_SHORT,
                           GL_UNSIGNED_SHORT, GL_BYTE, GL_UNSIGNED_BYTE};
  return table[static_cast<size_t>(type)];
}

static inline GLuint GetDataBytes(DataType type) {
  static GLenum table[] = {4, 4, 4, 2, 2, 1, 1};
  return table[static_cast<size_t>(type)];
}

static inline uint8_t GetAttribTypeComp(AttribType attribtype) {
  static uint8_t table[static_cast<size_t>(AttribType::Count)] = {2, 3, 3, 3, 3, 4};
  return table[static_cast<size_t>(attribtype)];
}

static inline const std::string GetVertexAttributeName(AttribType attribute) {
  static const std::string table[] = {
      "vTex", "vPos", "vNor", "vBi", "vTan", "vCol",
  };
  return table[static_cast<size_t>(attribute)];
}

} // namespace Model

#endif